package org.jsets.fastboot.routingds.config;

import java.util.Map;
import javax.sql.DataSource;
import com.google.common.collect.Maps;

public class DataSourceHolder {

	private static DataSource primaryDataSource;// 主数据源
	private static Map<String, DataSource> dataSources;

	protected static void setPrimaryDataSource(DataSource primaryDataSource) {
		DataSourceHolder.primaryDataSource = primaryDataSource;
	}

	protected static void setDataSources(Map<Object, Object> targets) {
		dataSources = Maps.newHashMap();
		for (Object target : targets.keySet()) {
			dataSources.put((String)target, (DataSource) targets.get(target));
		}
	}

	public static DataSource getPrimaryDataSource() {
		return primaryDataSource;
	}

	public static Map<String, DataSource> getDataSources() {
		return dataSources;
	}
}
